package com.rchat.pocmini.message;

import com.airtalkee.sdk.entity.AirMessage;
import com.airtalkee.sdk.entity.AirSession;

/**
 * Created by ljd on 2017/2/6.
 * <p>
 * 用户消息类，用以表示一个用户的即时消息
 */

public class PocAirMessage implements PocAirMessageInterface {

    private AirMessage airMessage = new AirMessage();
    //============= MSG_TYPE值 ===========
    //自定义类型的即时消息
    public static final int TYPE_CUSTOM = AirMessage.TYPE_CUSTOM;
    //文本类型的即时消息
    public static final int TYPE_TEXT = AirMessage.TYPE_TEXT;
    //语音类型的即时消息
    public static final int TYPE_RECORD = AirMessage.TYPE_RECORD;

    //============= MSG_CLS值 ===========
    //临时会话中的消息
    public static final int CLS_NORMAL = AirMessage.CLS_NORMAL;
    //固定频道中的消息
    public static final int CLS_CHANNEL = AirMessage.CLS_CHANNEL;

    public PocAirMessage() {
        airMessage = new AirMessage();
    }

    public PocAirMessage(String messageCode, String sessionCode, AirSession session, int type, String from, String fromName, String photoId, String body, String time, String date) {
        airMessage = new AirMessage(messageCode, sessionCode, session, type, from, fromName, photoId, body, time, date);
    }

    /**
     * 获取AirMessage实例
     *
     * @return airMessage
     */
    @Override
    public AirMessage getAirMessage() {
        return airMessage;
    }

    /**
     * 获取消息唯一ID
     *
     * @return airMessage.getMessageCode(
     */
    @Override
    public String getMessageCode() {
        return airMessage.getMessageCode();
    }

    /**
     * 获取所在会话的Code
     *
     * @return
     */
    @Override
    public String getSessionCode() {
        return airMessage.getSessionCode();
    }

    /**
     * 获取消息文本内容或自定义报文
     *
     * @return
     */
    @Override
    public String getBody() {
        return airMessage.getBody();
    }

    /**
     * 获取消息类型
     *
     * @return 消息的类型值（参考MSG_TYPE）
     */
    @Override
    public int getMessageType() {
        return airMessage.getType();
    }

    /**
     * 获取发送人的ID
     *
     * @return airMessage.getIpocidFrom()
     */
    @Override
    public String getIpocidFrom() {
        return airMessage.getIpocidFrom();
    }

    /**
     * 获取消息发送人的名称
     *
     * @return
     */
    @Override
    public String getInameFrom() {
        return airMessage.getInameFrom();
    }

    /**
     * 获取消息发送时的日期（YYYY-MM-DD）
     *
     * @return
     */
    @Override
    public String getDate() {
        return airMessage.getDate();
    }

    /**
     * 获取消息发送时的时间（hh:mm:ss）
     *
     * @return
     */
    @Override
    public String getTime() {
        return airMessage.getTime();
    }

    /**
     * 获取消息状态
     *
     * @return 消息状态值（参考MSG_STATE）
     */
    @Override
    public int getState() {
        return airMessage.getState();
    }

    /**
     * 获取消息所属（临时组或固定组）
     *
     * @return 参考MSG_CLS
     */
    @Override
    public int getCls() {
        return airMessage.getCls();
    }

    /**
     * 语音消息的资源ID
     *
     * @return
     */
    @Override
    public String getImageUri() {
        return airMessage.getImageUri();
    }

    /**
     * 语音消息的时长（单位:秒）
     *
     * @return
     */
    @Override
    public int getImageLength() {
        return airMessage.getImageLength();
    }


}
